//1.定义数组
var linkss = new Array();
//2.定义数组中泛型的构造方法
function Links(name,img,url){
    this.name = name;
    this.img = img;
    this.url = url;
}
//4.拷贝静态模板，根据数组元素的个数克隆对象后，追加道指定元素中
$(document).ready(function(){
    initLinks();
    var $linksTemplate = $(".linksPane > .linksInfo:eq(0)").clone();//克隆模板
    $(".linksPane").html("");//删除模板
    $(linkss).each(function(i,links){
       var $newLinks =  $linksTemplate.clone();
       $newLinks.find("a > img").attr("src","../images/links/"+links.img);//将克隆出来的内容修改为当前公司信息
        $newLinks.find("a > span").text(links.name);
        $newLinks.children("a").attr("href",links.url);
        $(".linksPane").append($newLinks);
    });
});


//3.初始化数组 列出当前类型的全部枚举
function initLinks(){
    linkss.push(new Links("四川开放大学","logo.png","http://www.scrtvu.net/"));
    linkss.push(new Links("超星学习通","sina.png","https://www.huike.com/index"));
    linkss.push(new Links("四川开放大学","1.jpg"));
    linkss.push(new Links("四川开放大学","2.gif"));
    linkss.push(new Links("四川开放大学","3.png"));
    linkss.push(new Links("四川开放大学","4.png"));
    linkss.push(new Links("四川开放大学","5.jpg"));
}